package com.smedi.ismedi.inmail.core.port.adapter.persistence.model;

import com.baomidou.mybatisplus.annotation.TableName;
import com.smedi.ismedi.database.starter.model.BasicFieldEntity;
import lombok.*;

import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDateTime;

/**
 * 每日天气
 *
 * @author jiangqinxuan
 * @date 2021/07/26
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName(value = "iml_login_log" )
public class LoginLogEntity extends BasicFieldEntity implements Serializable {
    /**
     * id
     */
    private Long id;
    /**
     * 标题
     */
    private String ip;
    /**
     * 登陆时间
     */
    private LocalDateTime loginTime;
    /**
     * 登出时间
     */
    private LocalDateTime logoutTime;
    /**
     * 登录人
     */
    private Long loginUserId;
    /**
     * 客户端类型
     */
    private String clientType;

    public Long getDuration(){
        return Duration.between(this.loginTime, this.logoutTime).toMinutes();
    }
}